//
//  Book.m
//  OC1_类和对象课后作业
//
//  Created by dllo on 15/10/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "Book.h"

@implementation Book

-(id)init
{

    _name = @"C程序设计";
    _price = 23.45;
    [self info];
    return self;

}

-(void)info
{

    NSLog(@"%@ %.2f", _name, _price);

}

-(void)sale
{

    NSLog(@"%@卖%.2f元", _name, _price);

}

-(NSString *)name
{
    return _name;
}

-(void)setName:(NSString *)name
{
    _name = name;
}
-(CGFloat)price
{
    return _price;
}
-(void)setPrice:(CGFloat)price
{
    _price = price;
}
-(id)initWithName:(NSString *)name price:(CGFloat)price
{
    _name = name;
    _price = price;
    return self;
}

+ (id)bookWithName:(NSString *)name price:(CGFloat)price
{
    Book *b = [[Book alloc] initWithName:name price:price];
    return b;
}


@end
